﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using TaDMS.Models;

namespace TaDMS.Commons
{
    public static class LoginHelper
    {
        public static int? GetCurrentUserId(string currentUsername)
        {
            using (var db = new UnitOfWork().AccountRepository)
            {
                var currentUser = db.Find(v => v.Username.Equals(currentUsername));
                int? currentUserId = currentUser != null ? currentUser.EmployeeId : null;
                return currentUserId;
            }
        }
    }
}